<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.bookstore.entity.User" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //取出 users
    List<User> users = (List<User>) request.getAttribute("users");
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/favicon.ico">
    <link rel="canonical" href="https://getbootstrap.com/docs/3.4/examples/dashboard/">

    <title>在线书城后台管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/dist/css/bootstrap.min.css"
          rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/css/ie10-viewport-bug-workaround.css"
          rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/examples/dashboard/dashboard.css"
          rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/ie8-responsive-file-warning.js"></script>
    <![endif]-->
    <script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<%@ include file="plugin/adminNav.jsp" %>

<div class="container-fluid">
    <div class="row">
        <%@ include file="plugin/adminLeftSideBar.jsp" %>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">


            <h2 class="sub-header">用户列表</h2>
            <!-- 绑定模态框按钮 -->
            <button class="btn btn-primary" data-toggle="modal" data-target="#productModal">添加用户</button>
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>用户ID</th>
                        <th>用户名称</th>
                        <th>用户性别</th>
                        <th>用户邮箱</th>
                        <th>用户号码</th>
                        <th>用户介绍</th>
                        <th>注册时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <%
                        for (int i = 0; i < users.size(); i++) {
                            User user = users.get(i);

                    %>
                    <tr>
                        <td><%=user.getId()%>
                        </td>
                        <td><%=user.getUsername()%>
                        </td>
                        <td><%=user.getGender()%>
                        </td>
                        <td><%=user.getEmail()%>
                        </td>
                        <td><%=user.getTelephone()%>
                        </td>
                        <td><%=user.getIntroduce()%>
                        </td>
                        <td><%=user.getRegistTime()%>
                        </td>
                        <td>
                            <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                            <button class="btn btn-danger">删除</button>
                        </td>
                    </tr>
                    <%
                        }
                    %>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<!-- 用户模态框部分 -->
<!-- Modal -->
<div class="modal fade" id="productModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">用户添加</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-1"></div>
                    <div class="col-md-10">
                        <form class="form-horizontal">
                            <div class="form-group">
                                <label for="productName" class="col-sm-3 control-label">用户名称</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="productName" placeholder="用户名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="productName" class="col-sm-3 control-label">用户价格</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="productName" placeholder="用户价格">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="productName" class="col-sm-3 control-label">用户分类</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="productName" placeholder="用户分类">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="productName" class="col-sm-3 control-label">用户数量</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="productName" placeholder="用户数量">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="productName" class="col-sm-3 control-label">用户图片</label>
                                <div class="col-sm-9">
                                    <input type="file" class="form-control" id="productName" placeholder="请上传用户图片">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="productName" class="col-sm-3 control-label">用户描述</label>
                                <div class="col-sm-9">
                                    <textarea class="form-control" id="productName" placeholder="用户描述"></textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="col-md-1"></div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary">保存</button>
            </div>
        </div>
    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ"
        crossorigin="anonymous"></script>
<script>
    window.jQuery || document.write(
        '<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/vendor/jquery.min.js"><\/script>'
    )
</script>
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/dist/js/bootstrap.min.js"></script>
<!-- Just to make our placeholder images work. Don't actually copy the next line! -->
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/vendor/holder.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
